﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Qianli.DirSir.Model;
using Qianli.DirSir.BLL;
using System.Data;
namespace 千里马后台
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、svc 和配置文件中的类名“Service1”。
    // 注意: 为了启动 WCF 测试客户端以测试此服务，请在解决方案资源管理器中选择 Service1.svc 或 Service1.svc.cs，然后开始调试。
    public class Service1 : IService1
    {
        UserBLL ubll = new UserBLL();
        GoodsBLL gbll = new GoodsBLL();
        DHLUPSFEDEXEMSInfoBLL dBLL = new DHLUPSFEDEXEMSInfoBLL();
        StorehouseInfoBLL Shibll = new StorehouseInfoBLL();
        CustomersInfoBLL cBLL = new CustomersInfoBLL();
        ProviderInfoBLL Probll = new ProviderInfoBLL();
        StockOrderInfoBLL obll = new StockOrderInfoBLL();
        FORMDHLUPSInfoBLL fdbll = new FORMDHLUPSInfoBLL();

        #region 用户管理

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="u">前台传过来的用户集合</param>
        /// <returns></returns>
        public int Login(Userinfo u)
        {
            UserBLL bll = new UserBLL();
            return bll.Login(u);
        }
        /// <summary>
        /// 根据用户名和密码获取用户编号
        /// </summary>
        /// <param name="u"></param>
        /// <returns></returns>
        public int GetUserID(Userinfo u)
        {
            UserBLL bll = new UserBLL();
            return bll.GetUserID(u);
        }
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="u"></param>
        /// <returns></returns>
        public int Register(Userinfo u)
        {
            UserBLL bll = new UserBLL();
            return bll.Register(u);
        }
        #endregion

        #region 店铺管理
        /// <summary>
        /// 显示店铺信息
        /// </summary>
        /// <returns></returns>
        public List<StoreInfo> ShowStoreInfo()
        {
            StoreInfoBLL bll = new StoreInfoBLL();
            return bll.ShowStoreInfo();
        }
        #endregion

        #region 仓库管理
        /// <summary>
        /// 显示仓库信息
        /// </summary>
        /// <returns></returns>
        public List<StorehouseInfo> Storehouseshow()
        {
            StorehouseInfoBLL bll = new StorehouseInfoBLL();
            return bll.Storehouseshow();
        }
        /// <summary>
        /// 添加仓库
        /// </summary>
        /// <param name="Shinfo"></param>
        /// <returns></returns>
        public int StorehouseAdd(StorehouseInfo Shinfo)
        {
            StorehouseInfoBLL bll = new StorehouseInfoBLL();
            return bll.StorehouseAdd(Shinfo);
        }
        /// <summary>
        /// 根据id获取仓库信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public StorehouseInfo StorehouseGetID(int id)
        {
            StorehouseInfoBLL bll = new StorehouseInfoBLL();
            return bll.StorehouseGetID(id);
        }
        /// <summary>
        /// 修改仓库信息
        /// </summary>
        /// <param name="Shinfo"></param>
        /// <returns></returns>
        public int StorehouseUpdate(StorehouseInfo Shinfo)
        {
            StorehouseInfoBLL bll = new StorehouseInfoBLL();
            return bll.StorehouseUpdate(Shinfo);
        }
        /// <summary>
        /// 根据id删除仓库
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int StorehouseDelete(int id)
        {
            StorehouseInfoBLL bll = new StorehouseInfoBLL();
            return bll.StorehouseDelete(id);
        }
        /// <summary>
        /// 按条件搜索显示
        /// </summary>
        /// <param name="SthName"></param>
        /// <returns></returns>
        public List<StorehouseInfo> StorehouseInfoSelect(string SthName, string Sthcoding)
        {
            StorehouseInfoBLL bll = new StorehouseInfoBLL();
            return bll.StorehouseInfoSelect(SthName, Sthcoding);
        }
        #endregion

        #region 采购订单管理
        /// <summary>
        /// 获取供应商信息，填充到下拉列表中
        /// </summary>
        /// <returns></returns>
        public List<ProviderInfo> GetProviderInfo()
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.GetProviderInfo();
        }
        /// <summary>
        /// 采购订单显示
        /// </summary>
        /// <returns></returns>
        public List<StockOrderInfo> StockOrderInfoShow()
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.StockOrderInfoShow();
        }
        /// <summary>
        /// 采购订单添加
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public List<int> AddStockOrderInfo(StockOrderInfo StockOrderInfo, List<PurchaseOrderSheetInfo> listPurchaseOrderSheetInfo)
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.AddStockOrderInfo(StockOrderInfo, listPurchaseOrderSheetInfo);
        }
        /// <summary>
        /// 采购订单表删除
        /// </summary>
        /// <returns></returns>
        public List<int> DelStockOrderInfo(int StockOrderID)
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.DelStockOrderInfo(StockOrderID);
        }
        /// <summary>
        /// 查看订单子表详细信息
        /// </summary>
        /// <param name="StockOrderID"></param>
        /// <returns></returns>
        public List<PurchaseOrderSheetInfo> GetlistPurchaseOrderSheetInfoByStockOrderID(int StockOrderID)
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.GetlistPurchaseOrderSheetInfoByStockOrderID(StockOrderID);
        }
        /// <summary>
        /// 查看入库订单子表详细信息
        /// </summary>
        /// <param name="StockOrderID"></param>
        /// <returns></returns>
        public List<PurchaseOrderSheetInfo> GetlistPurByStockOrderID(int StockOrderID)
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.GetlistPurByStockOrderID(StockOrderID);
        }
        /// <summary>
        /// 获取采购订单主表信息
        /// </summary>
        /// <param name="StockOrderID"></param>
        /// <returns></returns>
        public List<StockOrderInfo> GetStockOrderByStockOrderID(int StockOrderID)
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.GetStockOrderByStockOrderID(StockOrderID);
        }
        /// <summary>
        /// 修改采购订单信息
        /// </summary>
        /// <returns></returns>
        public List<int> UpdatePurchaseOrderSheetInfo(StockOrderInfo s, List<PurchaseOrderSheetInfo> listPurchaseOrderSheetInfo)
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.UpdatePurchaseOrderSheetInfo(s, listPurchaseOrderSheetInfo);
        }
        /// <summary>
        /// 根据采购订单模糊查询
        /// </summary>
        /// <param name="StockOrderName"></param>
        /// <returns></returns>
        public List<StockOrderInfo> GetStockOrderByStockOrderName(string DocumentsCoding)
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.GetStockOrderByStockOrderName(DocumentsCoding);
        }
        /// <summary>
        /// 初次审核
        /// </summary>
        /// <param name="StockOrderID"></param>
        /// <param name="listPurchaseOrderSheetInfo"></param>
        /// <returns></returns>
        public List<int> UpdPurchaseOrderSheetInfoByStockOrderID(int StockOrderID, List<PurchaseOrderSheetInfo> listPurchaseOrderSheetInfo)
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.UpdPurchaseOrderSheetInfoByStockOrderID(StockOrderID, listPurchaseOrderSheetInfo);
        }
        /// <summary>
        /// 根据采购订单子表编号获取信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public PurchaseOrderSheetInfo GetPurchaseOrderSheetByPurchaseOrderSheetID(int id)
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.GetPurchaseOrderSheetByPurchaseOrderSheetID(id);
        }
        /// <summary>
        /// 入库订单显示
        /// </summary>
        /// <returns></returns>
        public List<StockOrderInfo> StockOrderInfoShowFalse()
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.StockOrderInfoShowFalse();
        }
        /// <summary>
        /// 导出excel
        /// </summary>
        /// <returns></returns>
        public DataSet GetExcel()
        {
            StockOrderInfoBLL bll = new StockOrderInfoBLL();
            return bll.GetExcel();
        }
        #endregion

        #region 供应商管理
        /// <summary>
        /// 供应商显示
        /// </summary>
        /// <returns></returns>
        public List<ProviderInfo> ProviderInfoShow()
        {
            ProviderInfoBLL bll = new ProviderInfoBLL();
            return bll.ProviderInfoShow();
        }
        /// <summary>
        /// 添加供应商
        /// </summary>
        /// <param name="Shinfo"></param>
        /// <returns></returns>
        public int ProviderInfoAdd(ProviderInfo Provd)
        {
            ProviderInfoBLL bll = new ProviderInfoBLL();
            return bll.ProviderInfoAdd(Provd);
        }
        /// <summary>
        /// 根据id获取数据
        /// </summary>
        /// <param name="Proid"></param>
        /// <returns></returns>
        public ProviderInfo ProviderInfoGetID(int Proid)
        {
            ProviderInfoBLL bll = new ProviderInfoBLL();
            return bll.ProviderInfoGetID(Proid);
        }
        /// <summary>
        /// 修改供应商信息
        /// </summary>
        /// <param name="Provd"></param>
        /// <returns></returns>
        public int ProviderInfoUpdate(ProviderInfo Provd)
        {
            ProviderInfoBLL bll = new ProviderInfoBLL();
            return bll.ProviderInfoUpdate(Provd);
        }
        /// <summary>
        /// 根据ID删除
        /// </summary>
        /// <param name="Proid"></param>
        /// <returns></returns>
        public int ProviderInfoDelete(int Proid)
        {
            ProviderInfoBLL bll = new ProviderInfoBLL();
            return bll.ProviderInfoDelete(Proid);
        }
        /// <summary>
        /// 模糊查询
        /// </summary>
        /// <param name="ProName"></param>
        /// <returns></returns>
        public List<ProviderInfo> ProviderInfoSelect(string ProName)
        {
            ProviderInfoBLL bll = new ProviderInfoBLL();
            return bll.ProviderInfoSelect(ProName);
        }
        #endregion

        #region 商品管理
        /// <summary>
        /// 显示商品信息
        /// </summary>
        /// <returns></returns>
        public List<GoodsInfo> Goodshow()
        {
            GoodsBLL bll = new GoodsBLL();
            return bll.Goodshow();
        }
        /// <summary>
        /// 显示商品分类
        /// </summary>
        /// <returns></returns>
        public List<GoodsTypeInfo> showGoodsType()
        {
            GoodsBLL bll = new GoodsBLL();
            return bll.showGoodsType();
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="ss"></param>
        /// <returns></returns>
        public int addGoods(GoodsInfo ss)
        {
            GoodsBLL bll = new GoodsBLL();
            return bll.addGoods(ss);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int deleteGoods(int id)
        {
            GoodsBLL bll = new GoodsBLL();
            return bll.deleteGoods(id);
        }
        /// <summary>
        /// 根据id获取goods表信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public GoodsInfo GetGoodsByID(int id)
        {
            GoodsBLL bll = new GoodsBLL();
            return bll.GetGoodsByID(id);
        }
        /// <summary>
        /// 修改物品信息
        /// </summary>
        /// <param name="g"></param>
        /// <returns></returns>
        public int UptGoods(GoodsInfo g)
        {
            GoodsBLL bll = new GoodsBLL();
            return bll.UptGoods(g);
        }
        /// <summary>
        /// 根据姓名搜索物品表信息
        /// </summary>
        /// <param name="GoodsName"></param>
        /// <returns></returns>
        public List<GoodsInfo> SearchGoods(string GoodsName)
        {
            GoodsBLL bll = new GoodsBLL();
            return bll.SearchGoods(GoodsName);
        }
       
        #endregion

        #region 快递管理
        /// <summary>
        ///获取快递公司信息
        /// </summary>
        /// <returns></returns>
        public List<DHLUPSFEDEXEMSInfo> GetDHLUPSFEDEXEMSInfo()
        {
            DHLUPSFEDEXEMSInfoBLL bll = new DHLUPSFEDEXEMSInfoBLL();
            return bll.GetDHLUPSFEDEXEMSInfo();
        }
        /// <summary>
        /// 添加快递公司信息
        /// </summary>
        /// <param name="dh"></param>
        /// <returns></returns>
        public int AddDHLUPSFEDEXEMSInfo(DHLUPSFEDEXEMSInfo dh)
        {
            DHLUPSFEDEXEMSInfoBLL bll = new DHLUPSFEDEXEMSInfoBLL();
            return bll.AddDHLUPSFEDEXEMSInfo(dh);
        }

        /// <summary>
        /// 根据快递编号删除快递公司
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DelDHLUPSFEDEXEMSInfo(int id)
        {
            DHLUPSFEDEXEMSInfoBLL bll = new DHLUPSFEDEXEMSInfoBLL();
            return bll.DelDHLUPSFEDEXEMSInfo(id);
        }
        /// <summary>
        /// 根据id搜索快递表信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DHLUPSFEDEXEMSInfo getDHLUPSFEDEXEMSInfoByid(int id)
        {
            DHLUPSFEDEXEMSInfoBLL bll = new DHLUPSFEDEXEMSInfoBLL();
            return bll.getDHLUPSFEDEXEMSInfoByid(id);

        }
        /// <summary>
        /// 修改快递表信息
        /// </summary>
        /// <param name="dh"></param>
        /// <returns></returns>
        public int UptDHLUPSFEDEXEMSInfo(DHLUPSFEDEXEMSInfo dh)
        {
            DHLUPSFEDEXEMSInfoBLL bll = new DHLUPSFEDEXEMSInfoBLL();
            return bll.UptDHLUPSFEDEXEMSInfo(dh);
        }
        /// <summary>
        /// 根据姓名查询
        /// </summary>
        /// <param name="DHLUPSFEDEXEMSName"></param>
        /// <returns></returns>
        public List<DHLUPSFEDEXEMSInfo> SearchDHLUPSFEDEXEMSInfo(string DHLUPSFEDEXEMSName)
        {
            DHLUPSFEDEXEMSInfoBLL bll = new DHLUPSFEDEXEMSInfoBLL();
            return bll.SearchDHLUPSFEDEXEMSInfo(DHLUPSFEDEXEMSName);
        }
        #endregion

        #region 客户管理
        /// <summary>
        /// 显示客户信息
        /// </summary>
        /// <returns></returns>
        public List<CustomersInfo> ShowCustomersInfo()
        {
            CustomersInfoBLL bll = new CustomersInfoBLL();
            return bll.ShowCustomersInfo();
        }
        /// <summary>
        /// 显示城市信息
        /// </summary>
        /// <returns></returns>
        public List<CityInfo> ShowCity()
        {
            CustomersInfoBLL bll = new CustomersInfoBLL();
            return bll.ShowCity();
        }
        /// <summary>
        /// 添加客户信息
        /// </summary>
        /// <param name="cust"></param>
        /// <returns></returns>
        public int AddCustomersInfo(CustomersInfo cust)
        {
            CustomersInfoBLL bll = new CustomersInfoBLL();
            return bll.AddCustomersInfo(cust);
        }
        /// <summary>
        /// 删除客户信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DelCustomersInfo(int id)
        {
            CustomersInfoBLL bll = new CustomersInfoBLL();
            return bll.DelCustomersInfo(id);
        }
        /// <summary>
        /// 根据id获取客户信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public CustomersInfo GetCustomersInfoByid(int id)
        {
            CustomersInfoBLL bll = new CustomersInfoBLL();
            return bll.GetCustomersInfoByid(id);
        }
        /// <summary>
        /// 修改客户信息
        /// </summary>
        /// <param name="cust"></param>
        /// <returns></returns>
        public int UptCustomersInfo(CustomersInfo cust)
        {
            CustomersInfoBLL bll = new CustomersInfoBLL();
            return bll.UptCustomersInfo(cust);
        }
        /// <summary>
        /// 根据姓名搜索客户信息
        /// </summary>
        /// <param name="CustomersName"></param>
        /// <returns></returns>
        public List<CustomersInfo> GetCustomersInfoByCustomersName(string CustomersName)
        {
            CustomersInfoBLL bll = new CustomersInfoBLL();
            return bll.GetCustomersInfoByCustomersName(CustomersName);
        }
        #endregion

        #region 销售订单管理
        OrderInfoBLL Obll = new OrderInfoBLL();
        /// <summary>
        /// 添加商品订单信息
        /// </summary>
        /// <param name="oo"></param>
        /// <returns></returns>
        public int AddOrderInfo(OrderInfo oo, string xml)
        {
            OrderInfoBLL bll = new OrderInfoBLL();
            return bll.AddOrderInfo(oo, xml);
        }

        /// <summary>
        /// 获取订单信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<OrderInfo> ShowOrderInfo()
        {
            return Obll.ShowOrderInfo();
        }
        /// <summary>
        /// 根据ID获取订单子表信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<OrderSonInfo> oo(int id)
        {
            return Obll.oo(id);
        }
        /// <summary>
        /// 根据ID获取订单主表信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public OrderInfo GetOrderInfoByid(int id)
        {
            return Obll.GetOrderInfoByid(id);
        }
        /// <summary>
        /// 商品入库，增加库存数量
        /// </summary>
        /// <param name="orderID"></param>
        /// <returns></returns>
        public int Add_ruku(int orderID)
        {
            return Obll.Add_ruku(orderID);
        }
        /// <summary>
        /// 根据年，月，日
        /// </summary>
        /// <param name="StartTime"></param>
        /// <param name="End_Time"></param>
        /// <returns></returns>
        public List<OrderInfo> SelYear(string StartTime, string EndTime)
        {
            return Obll.SelYear(StartTime,EndTime);
        }
        public List<OrderInfo> SelMonth(string StartTime, string EndTime, string YearTime)
        {
            return Obll.SelMonth(StartTime,EndTime,YearTime);
        }
        public List<OrderInfo> SelDay(string StartTime, string EndTime, string YearTime, string MonthTime)
        {
            return Obll.SelDay(StartTime,EndTime,YearTime,MonthTime);
        }
        public List<GoodsInfo> GetGoodsByGoodsCoding(string GoodsCoding)
        {
            return gbll.GetGoodsByGoodsCoding(GoodsCoding);
        }
        #endregion

        #region 快递匹配
        /// <summary>
        /// 显示快递匹配
        /// </summary>
        /// <returns></returns>
        public List<FORMDHLUPSInfo> FORMDHLUPSInfoShow(int did)
        {
            return fdbll.FORMDHLUPSInfoShow(did);
        }
        /// <summary>
        /// 快递匹配添加
        /// </summary>
        /// <param name="f"></param>
        /// <returns></returns>
        public int FORMDHLUPSInfoAdd(int rid, string oid)
        {
            return fdbll.FORMDHLUPSInfoAdd(rid,oid);
        }
        /// <summary>
        /// 快递匹配删除
        /// </summary>
        /// <param name="fdid"></param>
        /// <returns></returns>
        public int FORMDHLUPSInfodDelete(int fdid)
        {
            return fdbll.FORMDHLUPSInfodDelete(fdid);
        }
        /// <summary>
        /// 获取快递名称
        /// </summary>
        /// <returns></returns>
        public List<DHLUPSFEDEXEMSInfo> kuaidiname()
        {
            return fdbll.kuaidiname();
        }
        /// <summary>
        /// 根据id获取城市
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        public List<CityInfo> GetidCity(int pid)
        {
            return fdbll.GetidCity(pid);
        }
        /// <summary>
        /// 根据快递编号获取城市编号
        /// </summary>
        /// <param name="rid"></param>
        /// <returns></returns>
        public List<FORMDHLUPSInfo> FORMDHLUPSInfoGetid(int rid)
        {
            return fdbll.FORMDHLUPSInfoGetid(rid);
        }
        /// <summary>
        /// 根据快递id删除所有的有关城市
        /// </summary>
        /// <param name="did"></param>
        /// <returns></returns>
        public int kuaidisahnchu(int did)
        {
            return fdbll.kuaidisahnchu(did);
        }
        #endregion

        #region 库存管理
        /// <summary>
        /// 显示库存信息
        /// </summary>
        /// <param name="oo"></param>
        /// <returns></returns>
        public List<InventoryInformationInfo> ShowInventory()
        {
            InventoryBLL ibll = new InventoryBLL();
            return ibll.ShowInventory();
        }
        /// <summary>
        /// 根据ID获取订单状态
        /// </summary>
        /// <returns></returns>
        public int GetByOrder(int id)
        {
            return Obll.GetByOrder(id);
        }
        #endregion    
    }     
}
